<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>CMU462 Library Documentation: CMU462::Renderer Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">CMU462 Library Documentation
   &#160;<span id="projectnumber">1.0</span>
   </div>
   <div id="projectbrief">Computer Graphics</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>CMU462</b></li><li class="navelem"><a class="el" href="class_c_m_u462_1_1_renderer.html">Renderer</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="class_c_m_u462_1_1_renderer-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">CMU462::Renderer Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div>  </div>
</div><!--header-->
<div class="contents">

<p>Abstract renderer definition.  
 <a href="class_c_m_u462_1_1_renderer.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="renderer_8h_source.html">renderer.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ae28a99fd51d4f13c47e83d9a1ec86f77"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_m_u462_1_1_renderer.html#ae28a99fd51d4f13c47e83d9a1ec86f77">~Renderer</a> (void)</td></tr>
<tr class="memdesc:ae28a99fd51d4f13c47e83d9a1ec86f77"><td class="mdescLeft">&#160;</td><td class="mdescRight">Virtual Destructor.  <a href="#ae28a99fd51d4f13c47e83d9a1ec86f77">More...</a><br /></td></tr>
<tr class="separator:ae28a99fd51d4f13c47e83d9a1ec86f77"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab18e62c5190185e655ff9f9ac955b2fd"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_m_u462_1_1_renderer.html#ab18e62c5190185e655ff9f9ac955b2fd">init</a> (void)=0</td></tr>
<tr class="memdesc:ab18e62c5190185e655ff9f9ac955b2fd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the renderer.  <a href="#ab18e62c5190185e655ff9f9ac955b2fd">More...</a><br /></td></tr>
<tr class="separator:ab18e62c5190185e655ff9f9ac955b2fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0946177a793c92fe87cfe022e0c9dc69"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_m_u462_1_1_renderer.html#a0946177a793c92fe87cfe022e0c9dc69">render</a> (void)=0</td></tr>
<tr class="memdesc:a0946177a793c92fe87cfe022e0c9dc69"><td class="mdescLeft">&#160;</td><td class="mdescRight">Draw content.  <a href="#a0946177a793c92fe87cfe022e0c9dc69">More...</a><br /></td></tr>
<tr class="separator:a0946177a793c92fe87cfe022e0c9dc69"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a567dd27c55e9cde4781c70c1971f62f1"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_m_u462_1_1_renderer.html#a567dd27c55e9cde4781c70c1971f62f1">resize</a> (size_t w, size_t h)=0</td></tr>
<tr class="memdesc:a567dd27c55e9cde4781c70c1971f62f1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Respond to buffer resize.  <a href="#a567dd27c55e9cde4781c70c1971f62f1">More...</a><br /></td></tr>
<tr class="separator:a567dd27c55e9cde4781c70c1971f62f1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a50f605fb9f81b4c9069cc784a37a43b4"><td class="memItemLeft" align="right" valign="top">virtual std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_m_u462_1_1_renderer.html#a50f605fb9f81b4c9069cc784a37a43b4">name</a> (void)=0</td></tr>
<tr class="memdesc:a50f605fb9f81b4c9069cc784a37a43b4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return a name for the renderer.  <a href="#a50f605fb9f81b4c9069cc784a37a43b4">More...</a><br /></td></tr>
<tr class="separator:a50f605fb9f81b4c9069cc784a37a43b4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0f30953b320b7adb05185a6bb8e40e8a"><td class="memItemLeft" align="right" valign="top">virtual std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_m_u462_1_1_renderer.html#a0f30953b320b7adb05185a6bb8e40e8a">info</a> (void)=0</td></tr>
<tr class="memdesc:a0f30953b320b7adb05185a6bb8e40e8a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return a brief description of the renderer.  <a href="#a0f30953b320b7adb05185a6bb8e40e8a">More...</a><br /></td></tr>
<tr class="separator:a0f30953b320b7adb05185a6bb8e40e8a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4de4579cdc97afae19846ffb94b96d19"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_m_u462_1_1_renderer.html#a4de4579cdc97afae19846ffb94b96d19">key_event</a> (char key)=0</td></tr>
<tr class="memdesc:a4de4579cdc97afae19846ffb94b96d19"><td class="mdescLeft">&#160;</td><td class="mdescRight">Respond to key event.  <a href="#a4de4579cdc97afae19846ffb94b96d19">More...</a><br /></td></tr>
<tr class="separator:a4de4579cdc97afae19846ffb94b96d19"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a97dbff9e0dc779d4472793d14889fb23"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_m_u462_1_1_renderer.html#a97dbff9e0dc779d4472793d14889fb23">cursor_event</a> (float x, float y, unsigned char keys)=0</td></tr>
<tr class="memdesc:a97dbff9e0dc779d4472793d14889fb23"><td class="mdescLeft">&#160;</td><td class="mdescRight">Respond to cursor events.  <a href="#a97dbff9e0dc779d4472793d14889fb23">More...</a><br /></td></tr>
<tr class="separator:a97dbff9e0dc779d4472793d14889fb23"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a709fded41665192529478edbe6ad935d"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_c_m_u462_1_1_renderer.html#a709fded41665192529478edbe6ad935d">scroll_event</a> (float offset_x, float offset_y)=0</td></tr>
<tr class="memdesc:a709fded41665192529478edbe6ad935d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Respond to zoom event.  <a href="#a709fded41665192529478edbe6ad935d">More...</a><br /></td></tr>
<tr class="separator:a709fded41665192529478edbe6ad935d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Abstract renderer definition. </p>
<p>The abstract class defines a general framework for user-space renderers. User space renderers can have different routines for drawing, and the viewer will call the render function to display the output of user space renderers. The viewer will also forward events such as buffer resizes to the user space renderer for it to respond. It will also pass events that it does not know how to handle to the renderer so that the renderer can define its own control keybindings, etc. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="ae28a99fd51d4f13c47e83d9a1ec86f77"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual CMU462::Renderer::~Renderer </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Virtual Destructor. </p>
<p>Each renderer implementation should define its own destructor that takes care of freeing the resources that it uses. </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="ab18e62c5190185e655ff9f9ac955b2fd"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void CMU462::Renderer::init </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Initialize the renderer. </p>
<p>A renderer may have some initialization work to do before it is ready to be used. The viewer will call the init function before using the renderer in drawing. </p>

</div>
</div>
<a class="anchor" id="a0946177a793c92fe87cfe022e0c9dc69"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void CMU462::Renderer::render </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Draw content. </p>
<p>Renderers are free to define their own routines for drawing to the context. The viewer calls this function on every frame update. </p>

</div>
</div>
<a class="anchor" id="a567dd27c55e9cde4781c70c1971f62f1"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void CMU462::Renderer::resize </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>w</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>h</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Respond to buffer resize. </p>
<p>The viewer will inform the renderer of a context resize by calling this function. The renderer has complete freedom to handle resizing, and a good renderer implementation should handle resizes properly. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">w</td><td>The new width of the context </td></tr>
    <tr><td class="paramname">h</td><td>The new height of the context </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a50f605fb9f81b4c9069cc784a37a43b4"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual std::string CMU462::Renderer::name </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Return a name for the renderer. </p>
<p>If the viewer has a renderer set at initialization, it will include the renderer name in the window title. </p>

</div>
</div>
<a class="anchor" id="a0f30953b320b7adb05185a6bb8e40e8a"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual std::string CMU462::Renderer::info </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Return a brief description of the renderer. </p>
<p>Each renderer can define this differently. The viewer will use the returned value in the renderer section of its on-screen display. </p>

</div>
</div>
<a class="anchor" id="a4de4579cdc97afae19846ffb94b96d19"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void CMU462::Renderer::key_event </td>
          <td>(</td>
          <td class="paramtype">char&#160;</td>
          <td class="paramname"><em>key</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Respond to key event. </p>
<p>Renderers are allowed to define their own control keybindings for user interaction but will only do this through the viewer. The viewer will try to handle all the window events and will inform the renderer of events that it does not care about. Therefore renderers should avoid using keybindings that the viewer already uses. (see Viewer for details) </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">key</td><td>The key being pressed by the user. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a97dbff9e0dc779d4472793d14889fb23"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void CMU462::Renderer::cursor_event </td>
          <td>(</td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>y</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char&#160;</td>
          <td class="paramname"><em>keys</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Respond to cursor events. </p>
<p>The viewer itself does not really care about the cursor but it will take the GLFW cursor events and forward the ones that matter to the renderer. The arguments are defined in screen space coordinates. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">x</td><td>the x coordinate of the cursor </td></tr>
    <tr><td class="paramname">y</td><td>the y coordinate of the cursor </td></tr>
    <tr><td class="paramname">keys</td><td>encodes the current mouse buttons state in a bitmask each bit from the least significant to the most significant encodes: right mouse button, middle mouse button, left mouse button. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a709fded41665192529478edbe6ad935d"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void CMU462::Renderer::scroll_event </td>
          <td>(</td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>offset_x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>offset_y</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Respond to zoom event. </p>
<p>Like cursor events, the viewer itself does not care about the mouse wheel either, but it will take the GLFW wheel events and forward them directly to the renderer. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">offset_x</td><td>scroll offset in x direction </td></tr>
    <tr><td class="paramname">offset_y</td><td>scroll offset in y direction </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>lib/<a class="el" href="renderer_8h_source.html">renderer.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Sep 2 2015 20:32:33 for CMU462 Library Documentation by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
